# -*- coding: utf-8 -*-

from PySide.QtCore import *
from PySide.QtGui import *
import sys

QTextCodec.setCodecForTr(QTextCodec.codecForName("utf8"))

class QQInfoPanel(QDialog):
    def __init__(self,parent=None):
        super(QQInfoPanel,self).__init__(parent)

        userLabel=QLabel(self.tr("用户名："))
        self.userEdit=QLineEdit()
        nameLabel=QLabel(self.tr("姓名："))
        self.nameEdit=QLineEdit()
        sexLabel=QLabel(self.tr("性别："))
        self.sexComboBox=QComboBox()
        self.sexComboBox.addItem(self.tr("男"))
        self.sexComboBox.addItem(self.tr("女"))
        deptLabel=QLabel(self.tr("部门："))
        self.deptAreaEdit=QTextEdit()
        ageLabel=QLabel(self.tr("年龄："))
        self.ageEdit=QLineEdit()
        remarkLabel=QLabel(self.tr("备注"))
        remarkLabel.setFrameStyle(QFrame.Panel | QFrame.Sunken)

        leftLayout=QGridLayout()
        leftLayout.addWidget(userLabel,0,0)
        leftLayout.addWidget(self.userEdit,0,1)
        leftLayout.addWidget(nameLabel,1,0)
        leftLayout.addWidget(self.nameEdit,1,1)
        leftLayout.addWidget(sexLabel,2,0)
        leftLayout.addWidget(self.sexComboBox,2,1)
        leftLayout.addWidget(deptLabel,3,0)
        leftLayout.addWidget(self.deptAreaEdit,3,1)
        leftLayout.addWidget(ageLabel,4,0)
        leftLayout.addWidget(self.ageEdit,4,1)
        leftLayout.addWidget(remarkLabel,5,0,1,2)
        #leftLayout.setColumnStretch(0,1)

        txLabel=QLabel(self.tr("头像"))
        txIconLabel=QLabel()
        icon=QPixmap("img/tx1.jpg")
        txIconLabel.setPixmap(icon)
        txIconLabel.resize(icon.width(),icon.height())
        iconPushButton=QPushButton(self.tr("改变"))
        hLayout=QHBoxLayout()
        hLayout.setSpacing(20)
        hLayout.addWidget(txLabel)
        hLayout.addWidget(txIconLabel)
        hLayout.addWidget(iconPushButton)

        grsmLabel=QLabel(self.tr("个人说明："))
        descTextEdit=QTextEdit()

        rightLayout=QVBoxLayout()
        rightLayout.setContentsMargins(10,10,10,10)
        rightLayout.addLayout(hLayout)
        rightLayout.addWidget(grsmLabel)
        rightLayout.addWidget(descTextEdit)

        okButton=QPushButton(self.tr("确定"))
        cancelButton=QPushButton(self.tr("取消"))
        buttonLayout=QHBoxLayout()
        buttonLayout.addWidget(okButton)
        buttonLayout.addWidget(cancelButton)

        mainLayout=QGridLayout(self)
        mainLayout.setContentsMargins(10,10,10,10)
        mainLayout.setSpacing(10)
        mainLayout.addLayout(leftLayout,0,0)
        mainLayout.addLayout(rightLayout,0,1)
        mainLayout.addLayout(buttonLayout,1,0,1,2)
        mainLayout.setSizeConstraint(QGridLayout.SetFixedSize)

        #self.setLayout(leftLayout)

if __name__=="__main__":
    app=QApplication(sys.argv)
    qqInfo=QQInfoPanel()
    qqInfo.show()
    sys.exit(app.exec_())